<?php
function smarty_modifier_formatSeconds($time) {
	$leadingZero = '';
	$output = '';

	if($time > 3600) {
		$leadingZero = '0';
		$output = floor($time / 3600);
		$time = $time % 3600;
	}else{
		$output = '00';
	}

	

	if($time >= 600) {
		$leadingZero = '';
		$output .= ":$leadingZero" . floor(($time / 60));
		$time = $time % 60;
	}elseif($time >= 60) {
		$leadingZero = '0';
		$output .= ":$leadingZero" . floor(($time / 60));
		$time = $time % 60;
	}else{
		$output .= ":00";
	}

	if($time >= 10) {
		$leadingZero = '';
	}else{
		$leadingZero = '0';
	}

	$output .= ":$leadingZero" . ($time);

	return $output;
}